<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts: esp8266/rtc.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">ESP8266ILI9341DisplayProject</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_cc2d49507704e901eabd8a82be491fc5.html">esp8266</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">rtc.c</div>  </div>
</div><!--header-->
<div class="contents">
<a href="rtc_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="user__config_8h.html">user_config.h</a>&quot;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="time_8h.html">time.h</a>&quot;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;</div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="rtc_8h.html">rtc.h</a>&quot;</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#ifdef RTC_DEBUG</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="mathio_8h.html">mathio.h</a>&quot;</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor">#include &lt;stdlib.h&gt;</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#include &lt;string.h&gt;</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="rtc_8c.html#a8e105ca35123da90e3d4db81f8848c4a">   25</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="rtc_8c.html#a8e105ca35123da90e3d4db81f8848c4a">rtc_ok</a> = 0;</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<a class="code" href="cpu_8h.html#ad0fe97585b8891f5e4f2b9a6426330a4">MEMSPACE</a></div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="rtc_8h.html#a21b4daa6e014855954f0c65787118d3b">   36</a></span>&#160;<a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> <a class="code" href="rtc_8c.html#a21b4daa6e014855954f0c65787118d3b">BINtoBCD</a>(<a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> data)</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;{</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    <span class="keywordflow">return</span>(  ( (data/10U) &lt;&lt; 4 ) | (data%10U) );</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;}</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<a class="code" href="cpu_8h.html#ad0fe97585b8891f5e4f2b9a6426330a4">MEMSPACE</a></div><div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="rtc_8h.html#a67b98d6ab52f9bfdd37f8ab0e706e3dd">   48</a></span>&#160;<a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> <a class="code" href="rtc_8c.html#a67b98d6ab52f9bfdd37f8ab0e706e3dd">BCDtoBIN</a>(<a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> data)</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;{</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    <span class="keywordflow">return</span>  ( ( ( (data&amp;0xf0U) &gt;&gt; 4) * 10 ) + (data&amp;0x0fU) );</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;}</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<a class="code" href="cpu_8h.html#ad0fe97585b8891f5e4f2b9a6426330a4">MEMSPACE</a></div><div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="rtc_8h.html#a9751c935395ca9c0355daa4bd91628bc">   63</a></span>&#160;<a class="code" href="earth2wireframe_8c.html#aef44329758059c91c76d334e8fc09700">int8_t</a> <a class="code" href="rtc_8c.html#a4884dfbdbea257da18e9a836d4a9530c">rtc_run_test</a>()</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;{</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    <a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> b = 0;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <span class="keywordflow">if</span> ( !I2C_read(<a class="code" href="rtc_8h.html#a3925233b7b37e63f8555ec63d941c847">DS1307</a>, 0, 1, &amp;b, 1) )</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    {</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;        I2C_display_error();</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;        <span class="keywordflow">return</span> (-1);</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    }</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <span class="keywordflow">if</span>(b &amp; 8)</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;        <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;}</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<a class="code" href="cpu_8h.html#ad0fe97585b8891f5e4f2b9a6426330a4">MEMSPACE</a></div><div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="rtc_8h.html#aedc81e1ee7ba3a324003ab7dc50d9c8f">   87</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="rtc_8c.html#aedc81e1ee7ba3a324003ab7dc50d9c8f">rtc_run</a>(<span class="keywordtype">int</span> run)</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;{</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> b = 0;</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    <span class="keywordflow">if</span> ( !I2C_read(<a class="code" href="rtc_8h.html#a3925233b7b37e63f8555ec63d941c847">DS1307</a>, 0, 1, &amp;b, 1) )</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    {</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;        I2C_display_error();</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;        <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    }</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <span class="keywordflow">if</span>(run == -1)</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        <span class="keywordflow">return</span> ((b &amp; 0x80) ? 0 : 1);</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    b = ( b  &amp; 0x7f) | (run ? 0 : 0x80);</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;    <span class="keywordflow">if</span> ( !I2C_write(<a class="code" href="rtc_8h.html#a3925233b7b37e63f8555ec63d941c847">DS1307</a>, 0, 1, &amp;b, 1) )</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    {</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;        I2C_display_error();</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;        <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;    }</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    <span class="keywordflow">return</span>(run);</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;}</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;<a class="code" href="cpu_8h.html#ad0fe97585b8891f5e4f2b9a6426330a4">MEMSPACE</a></div><div class="line"><a name="l00121"></a><span class="lineno"><a class="line" href="rtc_8h.html#a3c7ee7e39d1623daa499466e8cf55a71">  121</a></span>&#160;<a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> <a class="code" href="rtc_8c.html#a3c7ee7e39d1623daa499466e8cf55a71">rtc_init</a> (<span class="keywordtype">int</span> force, <a class="code" href="time_8h.html#a3346b04b0420b32ccf6b706551b70762">time_t</a> <a class="code" href="user__main_8c.html#ae112d79896ed83ac05e155da60e85523">seconds</a>)</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;{</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    <a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> buf[8];                               <span class="comment">/* RTC R/W buffer */</span></div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    <a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> addr;</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <a class="code" href="earth2wireframe_8c.html#aef44329758059c91c76d334e8fc09700">int8_t</a>    state;</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;    <a class="code" href="structtm.html">tm_t</a> *tmp;</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;    I2C_init(50000UL, 20000UL); <span class="comment">// 50KHZ 20mS ttimeout</span></div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    <span class="keywordflow">if</span>(!force)</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;    {</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;        state = <a class="code" href="rtc_8c.html#aedc81e1ee7ba3a324003ab7dc50d9c8f">rtc_run</a>(-1);</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;        <span class="keywordflow">if</span>(state &lt; 0)</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;        {</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;            <a class="code" href="rtc_8c.html#a8e105ca35123da90e3d4db81f8848c4a">rtc_ok</a> = 0;</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;            <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;        }</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;        <span class="keywordflow">if</span>(state == 0)                            <span class="comment">// stopped</span></div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;            force = 1;</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    }</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    <span class="keywordflow">if</span>(force)                                     <span class="comment">// INIT</span></div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;    {</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;        <span class="keywordflow">if</span>(<a class="code" href="rtc_8c.html#aedc81e1ee7ba3a324003ab7dc50d9c8f">rtc_run</a>(0) &lt; 0)                        <span class="comment">// STOP RTC</span></div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;        {</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;            <a class="code" href="rtc_8c.html#a8e105ca35123da90e3d4db81f8848c4a">rtc_ok</a> = 0;                           <span class="comment">// Fail</span></div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;            <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;        }</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;        tmp = <a class="code" href="time_8c.html#a10fe08d03c4c3da23d1e1c059f4cf3a5">gmtime</a>(&amp;seconds);</div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;        <span class="keywordflow">if</span>(!<a class="code" href="rtc_8c.html#a6324e98b85496ce2a90962bca93e77c9">rtc_write</a>(tmp))</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;        {</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;<span class="preprocessor">#ifdef RTC_DEBUG</span></div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;            <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;rtc _write epoch failed\n&quot;</span>);</div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;            <a class="code" href="rtc_8c.html#a8e105ca35123da90e3d4db81f8848c4a">rtc_ok</a> = 0;</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;            <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;        }</div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;</div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;        memset(buf, 0, 8);</div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;        <span class="keywordflow">for</span> (addr = 8; addr &lt; 0x3f; addr += 8)</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;        {</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;            <span class="keywordflow">if</span> ( !I2C_write(<a class="code" href="rtc_8h.html#a3925233b7b37e63f8555ec63d941c847">DS1307</a>, addr, 1, buf, 8) )</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;            {</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;                I2C_display_error();</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;                <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;            }</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;        }</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;        <span class="keywordflow">if</span>(<a class="code" href="rtc_8c.html#aedc81e1ee7ba3a324003ab7dc50d9c8f">rtc_run</a>(1) &lt; 0)                        <span class="comment">// START RTC</span></div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;        {</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;            <a class="code" href="rtc_8c.html#a8e105ca35123da90e3d4db81f8848c4a">rtc_ok</a> = 0;                           <span class="comment">// Fail</span></div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;            <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;        }</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;    }</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;    <a class="code" href="rtc_8c.html#a8e105ca35123da90e3d4db81f8848c4a">rtc_ok</a> = 1;</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;    <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;}</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;</div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;</div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;<a class="code" href="cpu_8h.html#ad0fe97585b8891f5e4f2b9a6426330a4">MEMSPACE</a></div><div class="line"><a name="l00189"></a><span class="lineno"><a class="line" href="rtc_8h.html#a6324e98b85496ce2a90962bca93e77c9">  189</a></span>&#160;<a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> <a class="code" href="rtc_8c.html#a6324e98b85496ce2a90962bca93e77c9">rtc_write</a>(<a class="code" href="structtm.html">tm_t</a> *t)</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;{</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    <a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> buf[8];</div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;</div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;    buf[0] =  <a class="code" href="rtc_8c.html#a21b4daa6e014855954f0c65787118d3b">BINtoBCD</a>(t-&gt;<a class="code" href="structtm.html#a4d098a9a5c03a00b2ee61e10851de81e">tm_sec</a>) &amp; 0x7f;</div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;    buf[1] =  <a class="code" href="rtc_8c.html#a21b4daa6e014855954f0c65787118d3b">BINtoBCD</a>(t-&gt;<a class="code" href="structtm.html#af414eb7c86cc3099595211eee4d4211b">tm_min</a>) &amp; 0x7f;</div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;    buf[2] =  <a class="code" href="rtc_8c.html#a21b4daa6e014855954f0c65787118d3b">BINtoBCD</a>(t-&gt;<a class="code" href="structtm.html#a3e7ca4e37f1abcaf56b8a916c38eb9fe">tm_hour</a>) &amp; 0x3f;</div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;    buf[3] =  ((t-&gt;<a class="code" href="structtm.html#afe81a8c46f1c693c43f259b288859f4f">tm_wday</a> &amp; 7) + 1) &amp; 0x0f;</div><div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;    buf[4] =  <a class="code" href="rtc_8c.html#a21b4daa6e014855954f0c65787118d3b">BINtoBCD</a>(t-&gt;<a class="code" href="structtm.html#ab8d8904bad43b0c8b96e61941c5b5310">tm_mday</a> ) &amp; 0x3f;</div><div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;    buf[5] =  <a class="code" href="rtc_8c.html#a21b4daa6e014855954f0c65787118d3b">BINtoBCD</a>(t-&gt;<a class="code" href="structtm.html#a112ac36fa2f593777138a417cf031e17">tm_mon</a> + 1) &amp; 0x1f;</div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    buf[6] =  <a class="code" href="rtc_8c.html#a21b4daa6e014855954f0c65787118d3b">BINtoBCD</a>(t-&gt;<a class="code" href="structtm.html#a33adf78fd6476b2120ce3b9c4a852053">tm_year</a> - 100) &amp; 0xff;  <span class="comment">// 2000 = 0</span></div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    buf[7] = 0x93;                                <span class="comment">// 32khz, out square wave</span></div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;<span class="preprocessor">#ifdef RTC_DEBUG</span></div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;rtc_write():%d, day:%d,mon:%d,hour:%d,min:%d,sec:%d, wday:%d\n&quot;</span>,</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;        t-&gt;<a class="code" href="structtm.html#a33adf78fd6476b2120ce3b9c4a852053">tm_year</a> + 1900,</div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;        t-&gt;<a class="code" href="structtm.html#a112ac36fa2f593777138a417cf031e17">tm_mon</a>,</div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;        t-&gt;<a class="code" href="structtm.html#ab8d8904bad43b0c8b96e61941c5b5310">tm_mday</a>,</div><div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;        t-&gt;<a class="code" href="structtm.html#a3e7ca4e37f1abcaf56b8a916c38eb9fe">tm_hour</a>,</div><div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;        t-&gt;<a class="code" href="structtm.html#af414eb7c86cc3099595211eee4d4211b">tm_min</a>,</div><div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;        t-&gt;<a class="code" href="structtm.html#a4d098a9a5c03a00b2ee61e10851de81e">tm_sec</a>,</div><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;        t-&gt;<a class="code" href="structtm.html#afe81a8c46f1c693c43f259b288859f4f">tm_wday</a>);</div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;</div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;<span class="preprocessor">#ifdef RTC_DEBUG</span></div><div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;%4x\n&quot;</span>, t);</div><div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;    <span class="keywordtype">int</span> i;</div><div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;rtc_write buf: &quot;</span>);</div><div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;    <span class="keywordflow">for</span>(i=0;i&lt;7;++i)</div><div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;        <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;%02x &quot;</span>, 0xff &amp; buf[i]);</div><div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;\n&quot;</span>);</div><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;</div><div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;    <span class="keywordflow">if</span> ( !I2C_write(<a class="code" href="rtc_8h.html#a3925233b7b37e63f8555ec63d941c847">DS1307</a>, 0, 1, buf, 8) )</div><div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;    {</div><div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;        I2C_display_error();</div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;        <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;    }</div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;    <span class="keywordflow">return</span>(1);</div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;}</div><div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;</div><div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;</div><div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;</div><div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;<a class="code" href="cpu_8h.html#ad0fe97585b8891f5e4f2b9a6426330a4">MEMSPACE</a></div><div class="line"><a name="l00238"></a><span class="lineno"><a class="line" href="rtc_8h.html#ab6c620f2f0bcbe90b65ecc723c03b645">  238</a></span>&#160;<a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> <a class="code" href="rtc_8c.html#ab6c620f2f0bcbe90b65ecc723c03b645">rtc_read</a>(<a class="code" href="structtm.html">tm_t</a> *t)</div><div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;{</div><div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;    <a class="code" href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> buf[8];</div><div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;</div><div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;    <span class="keywordflow">if</span> ( !I2C_read(<a class="code" href="rtc_8h.html#a3925233b7b37e63f8555ec63d941c847">DS1307</a>, 0, 1, buf, 8) )</div><div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;    {</div><div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;        I2C_display_error();</div><div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;        <span class="keywordflow">return</span> (0);</div><div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;    }</div><div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;<span class="preprocessor">#ifdef RTC_DEBUG</span></div><div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;%4x\n&quot;</span>, t);</div><div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;    <span class="keywordtype">int</span> i;</div><div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;rtc_read buf: &quot;</span>);</div><div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;    <span class="keywordflow">for</span>(i=0;i&lt;7;++i)</div><div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;        <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;%02x &quot;</span>, 0xff &amp; buf[i]);</div><div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;\n&quot;</span>);</div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;</div><div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;    t-&gt;<a class="code" href="structtm.html#a4d098a9a5c03a00b2ee61e10851de81e">tm_sec</a> =   <a class="code" href="rtc_8c.html#a67b98d6ab52f9bfdd37f8ab0e706e3dd">BCDtoBIN</a>( buf[0] &amp; 0x7f);</div><div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;    t-&gt;<a class="code" href="structtm.html#af414eb7c86cc3099595211eee4d4211b">tm_min</a> =   <a class="code" href="rtc_8c.html#a67b98d6ab52f9bfdd37f8ab0e706e3dd">BCDtoBIN</a>( buf[1] &amp; 0x7f);</div><div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;    t-&gt;<a class="code" href="structtm.html#a3e7ca4e37f1abcaf56b8a916c38eb9fe">tm_hour</a> =  <a class="code" href="rtc_8c.html#a67b98d6ab52f9bfdd37f8ab0e706e3dd">BCDtoBIN</a>( buf[2] &amp; 0x3f);</div><div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;    t-&gt;<a class="code" href="structtm.html#afe81a8c46f1c693c43f259b288859f4f">tm_wday</a> =  ( buf[3] &amp; 0x07) - 1;</div><div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;    t-&gt;<a class="code" href="structtm.html#ab8d8904bad43b0c8b96e61941c5b5310">tm_mday</a> =  <a class="code" href="rtc_8c.html#a67b98d6ab52f9bfdd37f8ab0e706e3dd">BCDtoBIN</a>( buf[4] &amp; 0x3f) ;</div><div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;    t-&gt;<a class="code" href="structtm.html#a112ac36fa2f593777138a417cf031e17">tm_mon</a>=    <a class="code" href="rtc_8c.html#a67b98d6ab52f9bfdd37f8ab0e706e3dd">BCDtoBIN</a>( buf[5] &amp; 0x1f) - 1;</div><div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;    t-&gt;<a class="code" href="structtm.html#a33adf78fd6476b2120ce3b9c4a852053">tm_year</a> =  <a class="code" href="rtc_8c.html#a67b98d6ab52f9bfdd37f8ab0e706e3dd">BCDtoBIN</a>( buf[6] &amp; 0xff) + 100;</div><div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;</div><div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;<span class="preprocessor">#ifdef RTC_DEBUG</span></div><div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;    <a class="code" href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a>(<span class="stringliteral">&quot;rtc_read():%d, day:%d,mon:%d,hour:%d,min:%d,sec:%d, wday:%d\n&quot;</span>,</div><div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;        t-&gt;<a class="code" href="structtm.html#a33adf78fd6476b2120ce3b9c4a852053">tm_year</a> + 1900,</div><div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;        t-&gt;<a class="code" href="structtm.html#a112ac36fa2f593777138a417cf031e17">tm_mon</a>,</div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;        t-&gt;<a class="code" href="structtm.html#ab8d8904bad43b0c8b96e61941c5b5310">tm_mday</a>,</div><div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;        t-&gt;<a class="code" href="structtm.html#a3e7ca4e37f1abcaf56b8a916c38eb9fe">tm_hour</a>,</div><div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;        t-&gt;<a class="code" href="structtm.html#af414eb7c86cc3099595211eee4d4211b">tm_min</a>,</div><div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;        t-&gt;<a class="code" href="structtm.html#a4d098a9a5c03a00b2ee61e10851de81e">tm_sec</a>,</div><div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;        t-&gt;<a class="code" href="structtm.html#afe81a8c46f1c693c43f259b288859f4f">tm_wday</a>);</div><div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;</div><div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;    <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;}</div><div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;</div><div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;</div><div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;</div><div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;</div><div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;</div><div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;<span class="preprocessor">#if 0</span></div><div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160;<a class="code" href="cpu_8h.html#ad0fe97585b8891f5e4f2b9a6426330a4">MEMSPACE</a></div><div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;<a class="code" href="send_8c.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a> <a class="code" href="fatfs__sup_8c.html#ae7b9417320aaaa1c1dfb229cad6669d8">tm_to_fat</a>(<a class="code" href="structtm.html">tm_t</a> *t)</div><div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;{</div><div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;    <a class="code" href="send_8c.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a> fat;</div><div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160;<span class="comment">/* Pack date and time into a uint32_t variable */</span></div><div class="line"><a name="l00310"></a><span class="lineno">  310</span>&#160;    fat = ((<a class="code" href="send_8c.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a>)(t-&gt;<a class="code" href="structtm.html#a33adf78fd6476b2120ce3b9c4a852053">tm_year</a> - 80) &lt;&lt; 25)</div><div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;        | (((<a class="code" href="send_8c.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a>)t-&gt;<a class="code" href="structtm.html#a112ac36fa2f593777138a417cf031e17">tm_mon</a>+1) &lt;&lt; 21)</div><div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;        | (((<a class="code" href="send_8c.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a>)t-&gt;<a class="code" href="structtm.html#ab8d8904bad43b0c8b96e61941c5b5310">tm_mday</a>) &lt;&lt; 16)</div><div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;        | ((<a class="code" href="send_8c.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a>)t-&gt;<a class="code" href="structtm.html#a3e7ca4e37f1abcaf56b8a916c38eb9fe">tm_hour</a> &lt;&lt; 11)</div><div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;        | ((<a class="code" href="send_8c.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a>)t-&gt;<a class="code" href="structtm.html#af414eb7c86cc3099595211eee4d4211b">tm_min</a> &lt;&lt; 5)</div><div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;        | ((<a class="code" href="send_8c.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a>)t-&gt;<a class="code" href="structtm.html#a4d098a9a5c03a00b2ee61e10851de81e">tm_sec</a> &gt;&gt; 1);</div><div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;    <span class="keywordflow">return</span>(fat);</div><div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;}</div><div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;</div><div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;</div><div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;<span class="preprocessor">#if 0</span></div><div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;<a class="code" href="cpu_8h.html#ad0fe97585b8891f5e4f2b9a6426330a4">MEMSPACE</a></div><div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;<a class="code" href="send_8c.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a> <a class="code" href="fatfs__sup_8c.html#ae0f1746ad69d0d4b90cba250c6774ca8">get_fattime</a> (<span class="keywordtype">void</span>)</div><div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;{</div><div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;    <a class="code" href="structtm.html">tm_t</a> t;</div><div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;</div><div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;<span class="comment">/* Get local time */</span></div><div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;    <span class="keywordflow">if</span>(!<a class="code" href="rtc_8c.html#ab6c620f2f0bcbe90b65ecc723c03b645">rtc_read</a>(&amp;t))</div><div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;        <span class="keywordflow">return</span>(0);</div><div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;    <span class="keywordflow">return</span>( <a class="code" href="fatfs__sup_8c.html#ae7b9417320aaaa1c1dfb229cad6669d8">tm_to_fat</a>(&amp;t) );</div><div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;}</div><div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="rtc_8h_html"><div class="ttname"><a href="rtc_8h.html">rtc.h</a></div></div>
<div class="ttc" id="fatfs__sup_8c_html_ae0f1746ad69d0d4b90cba250c6774ca8"><div class="ttname"><a href="fatfs__sup_8c.html#ae0f1746ad69d0d4b90cba250c6774ca8">get_fattime</a></div><div class="ttdeci">MEMSPACE DWORD get_fattime(void)</div><div class="ttdoc">Read time and convert to FAT32 time. </div><div class="ttdef"><b>Definition:</b> <a href="fatfs__sup_8c_source.html#l00130">fatfs_sup.c:130</a></div></div>
<div class="ttc" id="structtm_html_af414eb7c86cc3099595211eee4d4211b"><div class="ttname"><a href="structtm.html#af414eb7c86cc3099595211eee4d4211b">tm::tm_min</a></div><div class="ttdeci">int tm_min</div><div class="ttdef"><b>Definition:</b> <a href="time_8h_source.html#l00044">time.h:44</a></div></div>
<div class="ttc" id="user__config_8h_html"><div class="ttname"><a href="user__config_8h.html">user_config.h</a></div><div class="ttdoc">Master include file for project Includes all project includes and defines here. </div></div>
<div class="ttc" id="time_8h_html"><div class="ttname"><a href="time_8h.html">time.h</a></div><div class="ttdoc">Common Linux/POSIX time functions. </div></div>
<div class="ttc" id="rtc_8c_html_ab6c620f2f0bcbe90b65ecc723c03b645"><div class="ttname"><a href="rtc_8c.html#ab6c620f2f0bcbe90b65ecc723c03b645">rtc_read</a></div><div class="ttdeci">MEMSPACE uint8_t rtc_read(tm_t *t)</div><div class="ttdoc">Read DS1307 RTC into POSIX struct tm * structure. </div><div class="ttdef"><b>Definition:</b> <a href="rtc_8c_source.html#l00238">rtc.c:238</a></div></div>
<div class="ttc" id="structtm_html_ab8d8904bad43b0c8b96e61941c5b5310"><div class="ttname"><a href="structtm.html#ab8d8904bad43b0c8b96e61941c5b5310">tm::tm_mday</a></div><div class="ttdeci">int tm_mday</div><div class="ttdef"><b>Definition:</b> <a href="time_8h_source.html#l00046">time.h:46</a></div></div>
<div class="ttc" id="rtc_8c_html_a21b4daa6e014855954f0c65787118d3b"><div class="ttname"><a href="rtc_8c.html#a21b4daa6e014855954f0c65787118d3b">BINtoBCD</a></div><div class="ttdeci">MEMSPACE uint8_t BINtoBCD(uint8_t data)</div><div class="ttdoc">Convert number &gt;= 0 and &lt;= 99 to BCD. </div><div class="ttdef"><b>Definition:</b> <a href="rtc_8c_source.html#l00036">rtc.c:36</a></div></div>
<div class="ttc" id="structtm_html_a33adf78fd6476b2120ce3b9c4a852053"><div class="ttname"><a href="structtm.html#a33adf78fd6476b2120ce3b9c4a852053">tm::tm_year</a></div><div class="ttdeci">int tm_year</div><div class="ttdef"><b>Definition:</b> <a href="time_8h_source.html#l00048">time.h:48</a></div></div>
<div class="ttc" id="send_8c_html_a435d1572bf3f880d55459d9805097f62"><div class="ttname"><a href="send_8c.html#a435d1572bf3f880d55459d9805097f62">uint32_t</a></div><div class="ttdeci">unsigned int uint32_t</div><div class="ttdef"><b>Definition:</b> <a href="send_8c_source.html#l00019">send.c:19</a></div></div>
<div class="ttc" id="rtc_8h_html_a3925233b7b37e63f8555ec63d941c847"><div class="ttname"><a href="rtc_8h.html#a3925233b7b37e63f8555ec63d941c847">DS1307</a></div><div class="ttdeci">#define DS1307</div><div class="ttdef"><b>Definition:</b> <a href="rtc_8h_source.html#l00016">rtc.h:16</a></div></div>
<div class="ttc" id="time_8h_html_a3346b04b0420b32ccf6b706551b70762"><div class="ttname"><a href="time_8h.html#a3346b04b0420b32ccf6b706551b70762">time_t</a></div><div class="ttdeci">uint32_t time_t</div><div class="ttdoc">type of EPOCH result. </div><div class="ttdef"><b>Definition:</b> <a href="time_8h_source.html#l00035">time.h:35</a></div></div>
<div class="ttc" id="structtm_html_a112ac36fa2f593777138a417cf031e17"><div class="ttname"><a href="structtm.html#a112ac36fa2f593777138a417cf031e17">tm::tm_mon</a></div><div class="ttdeci">int tm_mon</div><div class="ttdef"><b>Definition:</b> <a href="time_8h_source.html#l00047">time.h:47</a></div></div>
<div class="ttc" id="rtc_8c_html_a4884dfbdbea257da18e9a836d4a9530c"><div class="ttname"><a href="rtc_8c.html#a4884dfbdbea257da18e9a836d4a9530c">rtc_run_test</a></div><div class="ttdeci">MEMSPACE int8_t rtc_run_test()</div><div class="ttdoc">Check if the DS1307 device is running. </div><div class="ttdef"><b>Definition:</b> <a href="rtc_8c_source.html#l00063">rtc.c:63</a></div></div>
<div class="ttc" id="rtc_8c_html_a6324e98b85496ce2a90962bca93e77c9"><div class="ttname"><a href="rtc_8c.html#a6324e98b85496ce2a90962bca93e77c9">rtc_write</a></div><div class="ttdeci">MEMSPACE uint8_t rtc_write(tm_t *t)</div><div class="ttdoc">Set DS1307 RTC from POSIX struct tm * structure. </div><div class="ttdef"><b>Definition:</b> <a href="rtc_8c_source.html#l00189">rtc.c:189</a></div></div>
<div class="ttc" id="earth2wireframe_8c_html_aef44329758059c91c76d334e8fc09700"><div class="ttname"><a href="earth2wireframe_8c.html#aef44329758059c91c76d334e8fc09700">int8_t</a></div><div class="ttdeci">signed char int8_t</div><div class="ttdef"><b>Definition:</b> <a href="earth2wireframe_8c_source.html#l00040">earth2wireframe.c:40</a></div></div>
<div class="ttc" id="rtc_8c_html_a3c7ee7e39d1623daa499466e8cf55a71"><div class="ttname"><a href="rtc_8c.html#a3c7ee7e39d1623daa499466e8cf55a71">rtc_init</a></div><div class="ttdeci">MEMSPACE uint8_t rtc_init(int force, time_t seconds)</div><div class="ttdoc">Initialize DS1307 rtc if not initialied - or if forced. </div><div class="ttdef"><b>Definition:</b> <a href="rtc_8c_source.html#l00121">rtc.c:121</a></div></div>
<div class="ttc" id="mathio_8h_html"><div class="ttname"><a href="mathio_8h.html">mathio.h</a></div><div class="ttdoc">Math IO functions, and verious conversion code with floating point support. </div></div>
<div class="ttc" id="time_8c_html_a10fe08d03c4c3da23d1e1c059f4cf3a5"><div class="ttname"><a href="time_8c.html#a10fe08d03c4c3da23d1e1c059f4cf3a5">gmtime</a></div><div class="ttdeci">MEMSPACE tm_t * gmtime(time_t *tp)</div><div class="ttdoc">Convert epoch GMT time_t *tp into POSIX static tm_t *t. </div><div class="ttdef"><b>Definition:</b> <a href="time_8c_source.html#l00471">time.c:471</a></div></div>
<div class="ttc" id="rtc_8c_html_a8e105ca35123da90e3d4db81f8848c4a"><div class="ttname"><a href="rtc_8c.html#a8e105ca35123da90e3d4db81f8848c4a">rtc_ok</a></div><div class="ttdeci">int rtc_ok</div><div class="ttdef"><b>Definition:</b> <a href="rtc_8c_source.html#l00025">rtc.c:25</a></div></div>
<div class="ttc" id="rtc_8c_html_a67b98d6ab52f9bfdd37f8ab0e706e3dd"><div class="ttname"><a href="rtc_8c.html#a67b98d6ab52f9bfdd37f8ab0e706e3dd">BCDtoBIN</a></div><div class="ttdeci">MEMSPACE uint8_t BCDtoBIN(uint8_t data)</div><div class="ttdoc">Convert two &quot;digit&quot; BCD number to binary. </div><div class="ttdef"><b>Definition:</b> <a href="rtc_8c_source.html#l00048">rtc.c:48</a></div></div>
<div class="ttc" id="structtm_html"><div class="ttname"><a href="structtm.html">tm</a></div><div class="ttdoc">POSIX struct tm. </div><div class="ttdef"><b>Definition:</b> <a href="time_8h_source.html#l00041">time.h:41</a></div></div>
<div class="ttc" id="rtc_8c_html_aedc81e1ee7ba3a324003ab7dc50d9c8f"><div class="ttname"><a href="rtc_8c.html#aedc81e1ee7ba3a324003ab7dc50d9c8f">rtc_run</a></div><div class="ttdeci">MEMSPACE int rtc_run(int run)</div><div class="ttdoc">Set DS1307 run state. </div><div class="ttdef"><b>Definition:</b> <a href="rtc_8c_source.html#l00087">rtc.c:87</a></div></div>
<div class="ttc" id="structtm_html_afe81a8c46f1c693c43f259b288859f4f"><div class="ttname"><a href="structtm.html#afe81a8c46f1c693c43f259b288859f4f">tm::tm_wday</a></div><div class="ttdeci">int tm_wday</div><div class="ttdef"><b>Definition:</b> <a href="time_8h_source.html#l00049">time.h:49</a></div></div>
<div class="ttc" id="cpu_8h_html_ad0fe97585b8891f5e4f2b9a6426330a4"><div class="ttname"><a href="cpu_8h.html#ad0fe97585b8891f5e4f2b9a6426330a4">MEMSPACE</a></div><div class="ttdeci">#define MEMSPACE</div><div class="ttdef"><b>Definition:</b> <a href="cpu_8h_source.html#l00025">cpu.h:25</a></div></div>
<div class="ttc" id="mathio_8h_html_ad6078f8da2d30ecaef99e0c2d250c0c8"><div class="ttname"><a href="mathio_8h.html#ad6078f8da2d30ecaef99e0c2d250c0c8">printf</a></div><div class="ttdeci">MEMSPACE int printf(const char *format,...)</div></div>
<div class="ttc" id="structtm_html_a4d098a9a5c03a00b2ee61e10851de81e"><div class="ttname"><a href="structtm.html#a4d098a9a5c03a00b2ee61e10851de81e">tm::tm_sec</a></div><div class="ttdeci">int tm_sec</div><div class="ttdef"><b>Definition:</b> <a href="time_8h_source.html#l00043">time.h:43</a></div></div>
<div class="ttc" id="structtm_html_a3e7ca4e37f1abcaf56b8a916c38eb9fe"><div class="ttname"><a href="structtm.html#a3e7ca4e37f1abcaf56b8a916c38eb9fe">tm::tm_hour</a></div><div class="ttdeci">int tm_hour</div><div class="ttdef"><b>Definition:</b> <a href="time_8h_source.html#l00045">time.h:45</a></div></div>
<div class="ttc" id="send_8c_html_aba7bc1797add20fe3efdf37ced1182c5"><div class="ttname"><a href="send_8c.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a></div><div class="ttdeci">unsigned char uint8_t</div><div class="ttdef"><b>Definition:</b> <a href="send_8c_source.html#l00017">send.c:17</a></div></div>
<div class="ttc" id="user__main_8c_html_ae112d79896ed83ac05e155da60e85523"><div class="ttname"><a href="user__main_8c.html#ae112d79896ed83ac05e155da60e85523">seconds</a></div><div class="ttdeci">time_t seconds</div><div class="ttdef"><b>Definition:</b> <a href="user__main_8c_source.html#l00293">user_main.c:293</a></div></div>
<div class="ttc" id="fatfs__sup_8c_html_ae7b9417320aaaa1c1dfb229cad6669d8"><div class="ttname"><a href="fatfs__sup_8c.html#ae7b9417320aaaa1c1dfb229cad6669d8">tm_to_fat</a></div><div class="ttdeci">MEMSPACE uint32_t tm_to_fat(tm_t *t)</div><div class="ttdoc">FAT time structer reference. </div><div class="ttdef"><b>Definition:</b> <a href="fatfs__sup_8c_source.html#l00113">fatfs_sup.c:113</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Jan 31 2018 21:22:16 for ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
